<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <script src="js/swiper-4.2.6.min.js" type="text/javascript" charset="utf-8"></script>
    <link rel="stylesheet" type="text/css" href="css/swiper-4.2.6.min.css"/>
    <script src="js/public.js" type="text/javascript" charset="utf-8"></script>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <script src="js/font.js"></script>
    <link rel="stylesheet" href="css/base.css">
    <link rel="stylesheet" href="css/ui.css">
    <title></title>
    <!-- 个人中心-设置-建议反馈 -->
    <style>
        
    </style>
</head>
<body>
<div class="scroll-content2 my-setup-suggest" style="overflow:auto;background: #F5F5F5;">
    <div class="top-public">
        <span class="public-center">建议反馈</span>        
        <img src="images/left_icon.png" alt="" class="public-left">
    </div>
    <div class="top-notice"><span>技术支持、系统故障、咨询服务等，请提交工单或拨打热线寻求支持。</span></div>
    <div class="write-title">
        <span>标题</span>
        <input type="text" id="title" placeholder="清晰的标题会更快被审核">
    </div>
    <div class="write-detail">
        <p>详细描述</p>
        <textarea name="" id="describe" cols="45" rows="5" placeholder="问题详情包含问题描述，步骤重现，业务影响及建议方案"></textarea>
    </div>
    <div class="write-bot">
        <ul>
            <li>
                <span>手机</span>
                <input type="text" id="mobile" placeholder="请输入手机号">
            </li>
            <li>
                <span>邮箱</span>
                <input type="text" id="mailbox" placeholder="请输入邮箱地址">
            </li>
        </ul>
    </div>
    <div class="sub-btn" onclick="subFeedback()">提交</div>
    
</div>
</body>
<script>
$('.public-left').click(function(){
    window.history.go(-1);
})
</script>

<script>
    $(function(){
        //验证是否登陆
        var user_id = sessionStorage.getItem('userId');
        if (user_id == null) {
            alert('请先登录！');
            window.location.href = 'login.html';
        }
    });
    
    //提交建议反馈
    function subFeedback() {
        var user_id = sessionStorage.getItem('userId');
        var title = $('#title').val();
        var describe = $('#describe').val();
        var mobile = $('#mobile').val();
        var mailbox = $('#mailbox').val();
        if (title == '') {
            alert('请填写标题！');
            return false;
        }  if (describe == '') {
            alert('请填写详情描述！');
            return false;
        }
        var myreg = /^1[3|4|5|7|8][0-9]{9}$/;
        if (mobile == '') {
            alert('请填写手机号！');
            return false;
        } else if (!myreg.test(mobile)) {
            alert('请输入正确的手机号！');
            return false;
        }
        var reg = new RegExp("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$");
        if (mailbox == '') {
            alert('请填写邮箱！');
            return false;
        } else if (!reg.test(mailbox)) {
            alert('请输入正确的邮箱地址！');
            return false;
        }
        $.ajax({
            url: url() + 'api/Users/feedback', //请求的url地址
            dataType: "JSON", //返回格式为json
            async: true, //请求是否异步，默认为异步，这也是ajax重要特性
            type: "POST", //请求方式
            data:{
                user_id:user_id,
                title:title,
                mobile:mobile,
                describe:describe,
                mailbox:mailbox,
            },
            success: function (data) {
                // 请求成功时处理
                if(data.status==1){
                    alert(data.msg);
                    window.location.href = 'my_setup.html';
                } else {
                    alert(data.msg);
                    window.location.href = 'my_setup_suggest.html';
                }
            }
        });
    }
</script>

</html> 






